<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"  
                xmlns:h="http://java.sun.com/jsf/html"  
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jstl/core"
                template="./../templates/StakeholderPortalTemplate.xhtml">

    <ui:define name="content">
        <h:form>
            <f:view beforePhase="#{mediaManagedBean.initView}">
                <p:panel id="stakeholderManageMediaPanel" header="#{bundle['stakeholder.managemedia.leftnav']}">
                    <p:messages id="statusMessages" redisplay="false" />
                    <p:dataTable id="manageMediaDataTable" value="#{mediaManagedBean.imageList}" var="image" scrollable="true" selection="#{mediaManagedBean.selectedImageList}" style="width: 80%" >
                        <div align="center">
                            <p:column selectionMode="multiple" style="width: 20px" />
                        </div>

                        <p:column style="width: 250px" headerText="#{bundle['managemedia.image.headerText']}">
                            <div align="center" ><h:graphicImage id="imagePreview" value="#{image.imageUrl}" style="width: 245px; height: 190px;" /></div>
                        </p:column>

                        <p:column style="width: 200px" headerText="#{bundle['managemedia.caption.headerText']}">
                            <div align="center" ><p:inputText id="caption" value="#{image.caption}"/></div>
                        </p:column>
                    </p:dataTable>

                    <p:growl id ="msgs" showDetail="true"></p:growl>
                    <p></p>
                    <p:commandButton style="width:100px" value="#{bundle['managemedia.remove.button']}" id="removeImageButton" ajax="true" process="@this manageMediaDataTable" onclick="confirmation.show()"/>

                    <p:confirmDialog message="#{bundle['media.confirmationdelete.dialogmessage']}" showEffect="  " hideEffect="explode" header="#{bundle['media.confirmationdelete.dialogmessage']}" severity="alert" widgetVar="confirmation">  
                        <p:commandButton update="manageMediaDataTable statusMessages" value="#{bundle['branch.confirmyes.button']}" oncomplete="confirmation.hide()" actionListener="#{mediaManagedBean.removeImage}" />  
                        <p:commandButton value="#{bundle['branch.confirmcancel.button']}" onclick="confirmation.hide()" type="button" />
                    </p:confirmDialog>  
                </p:panel>
            </f:view>
        </h:form>
    </ui:define>
</ui:composition>
